<?php

declare(strict_types=1);
/**
 * This file is part of bearing-web.
 *
 * @link     https://www.bearing.cn/
 * @contact  tech@bearing.cn
 * @license  https://gitee.com/cppo/bearing_web/-/blob/master/README.md
 */

namespace common\models;

use yii\elasticsearch\ActiveRecord;

/**
 * This is the model class for search miniature-bearings-table.
 *
 * @property int $id
 * @property int $cate_id
 * @property string $name
 * @property string $thumb
 * @property int $create_time
 * @property int $update_time
 * @property string $system_of_measurement
 * @property string $bearing_type
 * @property string $bore_dia
 * @property string $for_load_direction
 * @property string $outer_dia
 * @property string $width
 * @property string $seal_type
 * @property string $ring_material
 * @property string $ball_material
 * @property string $cage_material
 * @property string $flange_outer_dia
 * @property string $flange_thickness
 * @property string $external_diameter_on_inner_ring
 * @property string $inner_ring_width
 * @property string $dynamic
 * @property string $static
 * @property string $speed
 */
class FlangedBallBearingsSearchModel extends ActiveRecord
{
    public static function index(): string
    {
        return 'flanged-ball-bearings-table';
    }

    public static function type(): string
    {
        return '_doc';
    }

    public function attributes(): array
    {
        return ['bearing_type', 'cate_id', 'id', 'name', 'create_time', 'update_time', 'thumb', 'price', 'system_of_measurement', 'bore_dia', 'ring_material', 'for_load_direction', 'outer_dia', 'width', 'seal_type', 'flange_outer_dia', 'flange_thickness', 'external_diameter_on_inner_ring', 'inner_ring_width', 'cage_material', 'ball_material', 'dynamic', 'static', 'speed'];
    }

    public static function mapping(): array
    {
        return [
            'properties' => [
                'bearing_type' => ['type' => 'keyword'],
                'cate_id' => ['type' => 'integer'],
                'id' => ['type' => 'integer'],
                'name' => ['type' => 'keyword'],
                'create_time' => ['type' => 'integer'],
                'update_time' => ['type' => 'integer'],
                'thumb' => ['type' => 'text'],
                'price' => ['type' => 'float'],
                'system_of_measurement' => ['type' => 'keyword'],
                'bore_dia' => ['type' => 'keyword'],
                'ring_material' => ['type' => 'keyword'],
                'for_load_direction' => ['type' => 'keyword'],
                'outer_dia' => ['type' => 'keyword'],
                'width' => ['type' => 'keyword'],
                'seal_type' => ['type' => 'keyword'],
                'flange_outer_dia' => ['type' => 'keyword'],
                'flange_thickness' => ['type' => 'keyword'],
                'external_diameter_on_inner_ring' => ['type' => 'keyword'],
                'inner_ring_width' => ['type' => 'keyword'],
                'cage_material' => ['type' => 'keyword'],
                'ball_material' => ['type' => 'keyword'],
                'dynamic' => ['type' => 'keyword'],
                'static' => ['type' => 'keyword'],
                'speed' => ['type' => 'float'],
            ],
        ];
    }
}
